Compiler Design


Q81.

What is the number of steps required to derive the string ((() ()) ()) for the following grammar? S \rightarrow S SS \rightarrow(S)S \rightarrow \varepsilon
GateOverflow

Q82.

Consider the grammar defined by the following production rules, with two operators * and + S \rightarrowT *P T \rightarrowU| T*U P \rightarrow Q +P |Q Q \rightarrow Id U \rightarrow Id Which one of the following is TRUE?
GateOverflow

Q83.

Which of the following productions eliminate left recursion in the productions given below: S \rightarrow Aa \mid b A \rightarrow Ac \mid Sd \mid \epsilon
GateOverflow

Q84.

Consider the following two sets of LR(1) items of an LR(1) grammar. \begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕  d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array} Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE? 1. Cannot be merged since look aheads are different. 2. Can be merged but will result in S-R conflict. 3. Can be merged but will result in R-R conflict. 4. Cannot be merged since goto on c will lead to two different sets.
GateOverflow

Q85.

A canonical set of items is given below S\rightarrow L. \gt R Q\rightarrowR. On input symbol \lt the set has
GateOverflow

Q86.

Shift reduce parsing belongs to a class of
GateOverflow

Q87.

What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A\rightarrow \epsilon and A \rightarrow a ) to parse a string with n tokens?
GateOverflow

Q88.

For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. \varepsilon is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.S\rightarrow aAbB|bAaB|\varepsilon A\rightarrow S B\rightarrow S The FIRST and FOLLOW sets for the non-terminals A and B are
GateOverflow

Q89.

Consider two binary operators '\uparrow 'and '\downarrow' with the precedence of operator \downarrow being lower than that of the operator \uparrow . Operator \uparrow is right associative while operator \downarrow is left associative. Which one of the following represents the parse tree for expression (7 \downarrow 3 \uparrow4 \uparrow 3 \downarrow2)?
GateOverflow

Q90.

Consider the grammar S \rightarrow ABCc \mid bc BA \rightarrow AB Bb \rightarrow bb Ab \rightarrow ab Aa \rightarrow aa Which of the following sentences can be derived by this grammar?
GateOverflow